#!/usr/bin/env python
# coding=utf-8
# Copyright © 2016 ldf@eehello.com All Rights Reserved
# 本程序在python2.7下测试通过
shops = {'tv':3000,'iphone':5000,'tea':10,'move':35,'spring':1200,
         'fangte':200,'shopping':500}

buys = []
money = 0

flag = 1
while flag:
    print('物品清单为：')
    for i in shops:
        print('物品:%s,价格为:%d元' % (i,shops[i]))

    print('----------------------------------------------------------')
    print('您将要消费的金额 %d' % money)
    buy = raw_input('请输入你想购买的物品名称(退出请按字母 q ):')
    if buy == 'q':
        flag = 0
        break

    buys.append(buy)
    money += shops[buy]

if len(buys) == 0:
    print('您未购买物品')
else:
    print('你购买了如下产品:')
    for i in buys:
        print(i)
    print('您总共需付款：%d' % money)

print("如需信用卡付款，请按 'y'，否则请按'q'")
puanduan = raw_input()
if puanduan == 'y':
    kahao = input('请输入您的卡号：')

    kodel = __import__('backgroud.jiami')
    jiami = getattr(kodel, 'jiami')

    mima = jiami.jiami_md5(raw_input('请输入您的密码:'))

    model001 = __import__('backgroud.shop')
    shop001 = getattr(model001, 'shop')
    shop001.run(money,kahao,mima)

if puanduan = 'q':
    exit()
